<%

Dim ID	
Dim Big_ID
Dim Corp_City_Area
Dim City_ID
Dim Corp_Type
Dim Corp_Name
Dim Corp_Pic
Dim Corp_Detail		
Dim Corp_Tel		
Dim Corp_Fax		
Dim Corp_Address
Dim Corp_Address_S
Dim Corp_Open		
Dim Corp_Business	
Dim Corp_SI
Dim Corp_Audit		
Dim Corp_Gold_Flag	

Dim Update_Name
Dim Update_Date

Dim Action
Dim Info_ID

Sub Get_Corp_Info_Data()

	Big_ID = reform("Big_ID")
	Call Check_IsNumeric_Msg(Big_ID,"企业分类ID")

	Corp_Type = reform("Corp_Type")
	Call Check_IsNumeric_Msg(Corp_Type,"企业分类ID")

	City_ID = reform("City_ID")
	Call Check_IsNumeric_Msg(City_ID,"选择地区")

	Corp_City_Area = reform("Corp_City_Area")
	Call Check_IsNumeric_Msg(Corp_City_Area,"选择地区")
	
	Corp_City_Area	= reform("Corp_City_Area")	
	
	Corp_City_Area	= reform("Corp_City_Area")	
	Corp_Type		= reform("Corp_Type")	
	Corp_Name		= reform("Corp_Name")
	Corp_Pic		= reform("Corp_Pic")
	Corp_Detail		= reform("Corp_Detail")	
	Corp_Tel		= reform("Corp_Tel")	
	Corp_Fax		= reform("Corp_Fax")	
	Corp_Address	= reform("Corp_Address")	
	Corp_Address_S	= reform("Corp_Address_S")	

	Corp_Open		= reform("Corp_Open")	
	Corp_Business	= reform("Corp_Business")	
	Corp_SI			= reform("Corp_SI")	

	Corp_Audit		= reform("Corp_Audit")	
	Corp_Gold_Flag	= reform("Corp_Gold_Flag")	

	Update_Name		= Session("Admin_UserName")
	Update_Date		= now()
	
End Sub 
Sub Corp_Info_Action()
	Info_ID = Get_ID("Info_ID")
	If Info_ID=0 Then 
		Call Corp_Info_Add()
	Else
		Call Corp_Info_Edit()
	End If 
End Sub 
Sub Corp_Info_Add()	
	

	Call Get_Corp_Info_Data()

	sql = "INSERT INTO Corp_Info( " &_
		"Corp_Type"&_

		",Corp_City_Area"&_
		",Corp_Name"&_
		",Corp_Pic"&_		
		",Corp_Detail"&_
		",Corp_Tel"&_
		",Corp_Fax"&_
		",Corp_Address"&_
		",Corp_Address_S"&_		
		",Corp_Open"&_
		",Corp_Business"&_
		",Corp_SI"&_

		",Corp_Audit"&_
		",Corp_Gold_Flag"&_

		",Update_Name"&_
		",Update_Date"&_

		") VALUES( " &_
		""&Corp_Type&_
		","&Corp_City_Area&_

		",'"&Corp_Name&"'"&_
		",'"&Corp_Pic&"'"&_
		",'"&Corp_Detail&"'"&_
		",'"&Corp_Tel&"'"&_
		",'"&Corp_Fax&"'"&_
		
		",'"&Corp_Address&"'"&_
		",'"&Corp_Address_S&"'"&_
		",'"&Corp_Open&"'"&_
		",'"&Corp_Business&"'"&_
		",'"&Corp_SI&"'"&_

		","&Corp_Audit&_
		","&Corp_Gold_Flag&_

		",'"&Update_Name&"'"&_
		",'"&Update_Date&"'"&_
		")"


    conn.execute(sql)


	'Session("IT_ID") = IT_ID

	AlertBox "企业信息增加成功！","Corp_Info_Query.asp"


End Sub

Sub Corp_Info_Edit()	


	Call Get_Corp_Info_Data()
	Info_ID = Reform("Info_ID")
	Call Check_IsNumeric(Info_ID)

	sql = "UPDATE Corp_Info Set " &_
		  "Corp_Type = "& Corp_Type &_
		  ",Corp_City_Area = "& Corp_City_Area &_

		  ",Corp_Name ='"&Corp_Name&"'"&_
		  ",Corp_Pic ='"&Corp_Pic&"'"&_		  
		  ",Corp_Detail ='"&Corp_Detail&"'"&_
		  ",Corp_Tel ='"&Corp_Tel&"'"&_
		  ",Corp_Fax ='"&Corp_Fax&"'"&_
		  ",Corp_Address ='"&Corp_Address&"'"&_
		  ",Corp_Address_S ='"&Corp_Address_S&"'"&_
		  ",Corp_Open ='"&Corp_Open&"'"&_
		  ",Corp_Business ='"&Corp_Business&"'"&_
		  ",Corp_SI ='"&Corp_SI&"'"&_

		  ",Corp_Audit ="&Corp_Audit&_
		  ",Corp_Gold_Flag ="&Corp_Gold_Flag&_

		  ",Update_Name ='"&Update_Name&"'"&_
		  ",Update_Date ='"&Update_Date&"'"&_

		  " WHERE Corp_Username = "&Info_ID

    conn.execute(sql)

	AlertBox "企业信息修改成功！","Corp_Info_Query.asp"

End Sub

Sub Corp_Info_Del()

	Info_ID = Reform("OP_ID")

	sql = "DELETE FROM  Corp_Info WHERE ID IN ( "&Info_ID &")"

    conn.execute(sql)

	AlertBox "企业信息删除成功！","Corp_Info_Query.asp"
	
End Sub

Sub Get_Corp_Info(ID)

	Info_ID = Get_ID(ID)
	If Info_ID=0 Then 
		Action = "增加"
		If Corp_Audit="" Then Corp_Audit="0"
		If Corp_Gold_Flag="" Then Corp_Gold_Flag="0"

		Exit Sub 
	End If 

	Sql = "SELECT * FROM Corp_Info WHERE ID="&Info_ID


	Set rs = conn.execute(sql)
	
	If Not rs.eof Then
		Corp_City_Area	= rs("Corp_City_Area") 
		Corp_Type       = rs("Corp_Type")
		Corp_Name		= rs("Corp_Name")
		Corp_Pic		= rs("Corp_Pic")
		Corp_Detail		= rs("Corp_Detail")
		Corp_Tel		= rs("Corp_Tel")
		Corp_Fax		= rs("Corp_Fax")
		Corp_Address	= rs("Corp_Address")
		Corp_Address_S	= rs("Corp_Address_S")
		Corp_Open		= rs("Corp_Open")
		Corp_Business	= rs("Corp_Business")
		Corp_SI			= rs("Corp_SI")

		Corp_Audit		= rs("Corp_Audit")
		Corp_Gold_Flag	= rs("Corp_Gold_Flag")

					   
		Update_Name    = rs("Update_Name")
		Update_Date    = rs("Update_Date")

	End If
	Big_ID = Get_FirstValue("SELECT Parent_ID FROM Corp_Type WHERE ID="&Corp_Type)
	City_ID = Get_FirstValue("SELECT Parent_ID FROM City_Area WHERE ID="&Corp_City_Area)

	Action="修改"
End Sub 
Function Get_ID(Info_ID)
	If Request.ServerVariables ("Request_Method")="POST" Then
		ID = reform(Info_ID)
	Else
		ID = requery(Info_ID)
	End If 
	If IsNumeric(ID)=False Then 
		Get_ID = 0
	Else
		Get_ID = ID
	End If 
End Function 
Sub Show_Corp_SI(Corp_SI)
	Array_List = GetRsRows("SELECT ID,SI_Name FROM Corp_Service_Item ORDER BY SI_Order ASC ")
	If IsArray(Array_List) Then 
		For i=0 To UBound(Array_List,2)
			Response.Write "<input type=""checkbox"" name=""Corp_SI"" value="""&Array_List(0,i)&""" "&get_check(array_list(0,i),corp_si)&">"&Array_List(1,i)&"&nbsp;&nbsp;&nbsp;&nbsp;"
		Next 
	End If 
End Sub 
Function get_check(d_id,corp_si)
	If IsNull(corp_si) Then 
		get_check = ""
		Exit Function 
	End If 
	corp_si_array = Split(corp_si,",")
	For xx=0 To UBound(corp_si_array)
		If CStr(d_id)=CStr(Trim(corp_si_array(xx))) Then 
			get_check = "checked"
			Exit Function 
			
		End If 

	Next 
	get_check = ""

End function
%>


